package me.edzh.spring.bootstrap.utils;
import org.apache.ibatis.executor.ErrorContext;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.log4j.Logger;
import org.mybatis.spring.SqlSessionFactoryBean;

import java.io.IOException;

/**
 * Created by EdCho
 * 2018/4/6 006.
 */
public class FixedSqlSessionFactory extends SqlSessionFactoryBean{
    Logger logger = Logger.getLogger(FixedSqlSessionFactory.class);
    @Override
    protected SqlSessionFactory buildSqlSessionFactory() throws IOException {
        try {
            return super.buildSqlSessionFactory();
        }catch (Exception e){
            logger.error("err in buildSqlSessionFactory");
            e.printStackTrace();

            ErrorContext.instance().reset();
            return null;
        }
    }
}